<?php get_header(); ?>
	
	<?php if(!is_paged()) { ?>

	<div id="top" class="clearfloat">
	
		<div id="headline">
			<img src="<?php bloginfo('template_url'); ?>/images/headline.png" width="75" height="21" alt="" />
			
			<?php query_posts("showposts=1&category_name=Headline"); ?>
			<?php while (have_posts()) : the_post(); 
					$values = get_post_custom_values("Image");
			?>	
				
                <div class="title">
                	<a href="<?php the_permalink();?>" rel="bookmark"><?php the_title(); ?></a>
               	</div>
				
                <div class="meta">
                	[ <?php the_time('j M Y') ?> | <?php comments_popup_link('No Comment', 'One Comment', '% Comments');?> <?php if(function_exists('the_views')) { ?>| <?php the_views(); } ?>]
               	</div>	
                <?php if (has_post_thumbnail()) { 
				?>
					 <a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
					 	<?php
					 		the_post_thumbnail('headline',array('class'=>'headline-thumb-wrapper', 'title'=>$title));
						?>
                	</a>
				<?php
				} else 
				if (isset($values[0])){
				?> 
					<a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
					<img src="<?php echo bloginfo('template_url'); ?>/scripts/timthumb.php?src=/<?php echo urlencode($values[0]); ?>&amp;w=300&amp;h=275&amp;zc=1&amp;q=100" alt="<?php the_title(); ?>" class="left" width="300" height="275"  /></a>
				<?php
				} else {
				?>
                	<a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
					<img src="<?php echo bloginfo('template_url'); ?>/scripts/timthumb.php?src=/images/no-image.png&amp;w=300&amp;h=275&amp;zc=1&amp;q=100" alt="<?php the_title(); ?>" class="left" width="300" height="275"  /></a>
                <?php } ?>
	
				<?php the_excerpt(); ?>
				<a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">Read the full story &raquo;</a>
		<?php endwhile; ?>
	</div>
		
	<div id="featured">
	
	<img src="<?php bloginfo('template_url'); ?>/images/featured.png" width="72" height="17" alt="" />

	<?php query_posts("showposts=4&category_name=Featured"); $i = 1; ?>

   	<?php while (have_posts()) : the_post(); 
			$values = get_post_custom_values("Image");
	?>
		
        <div class="clearfloat">
      		
             <?php if (has_post_thumbnail()) { 
				?>
					 <a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
					 	<?php
					 		the_post_thumbnail('featured',array('class'=>'featured-thumb-wrapper', 'title'=>$title));
						?>
                	</a>
				<?php
				} else 
				if (isset($values[0])){
				?> 
					<a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
					<img src="<?php echo bloginfo('template_url'); ?>/scripts/timthumb.php?src=/<?php echo urlencode($values[0]); ?>&amp;w=100&amp;h=65&amp;zc=1&amp;q=100" alt="<?php the_title(); ?>" class="left" width="100" height="65"  /></a>
				<?php
				} else {
				?>
                	<a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
					<img src="<?php echo bloginfo('template_url'); ?>/scripts/timthumb.php?src=/images/no-image.png&amp;w=100&amp;h=65&amp;zc=1&amp;q=100" alt="<?php the_title(); ?>" class="left" width="100" height="65"  /></a>
                <?php } ?>
            
			<div class="info">
        		<a href="<?php the_permalink(); ?>" rel="bookmark" class="title"><?php the_title(); ?></a>
				<div class="meta">[ <?php the_time('j M Y') ?> | <?php comments_popup_link('No Comment', 'One Comment', '% Comments');?> <?php if(function_exists('the_views')) { ?>|  <?php the_views(); } ?>]
                </div>	
	
			</div>
    	</div>
	
	<?php endwhile; ?>

	</div>

</div>	

	<div id="middle" class="clearfloat">
	<img src="<?php bloginfo('template_url'); ?>/images/category.png" class="clearfloat" alt="" />
	<?php $display_categories = array(47,46,48,49,50); $i = 1;
	foreach ($display_categories as $category) { ?>

	<div id="cat-<?php echo $i; ?>" class="category" onclick="window.location.href='<?php echo get_category_link($category);?>'" >
		<?php query_posts("showposts=1&cat=$category")?>
		<?php if (is_category($category)) { ?>
		<span class="cat_title"><?php single_cat_title(); ?></span>
        
		<?php echo category_description($category);  } ?>
	</div>

	<?php $i++; ?>
    	<?php } ?>

	</div>

	<?php } ?>

	<div id="bottom" class="clearfloat">
		
	<div id="front-list">	
	
	<?php
      $page = (get_query_var('paged')) ? get_query_var('paged') : 1;
      query_posts("cat=-27,-28&paged=$page"); ?>
	
	<?php while (have_posts()) : the_post(); 
		$values = get_post_custom_values("Image");
	?>		

	<div class="clearfloat">
	<h3 class="cat_title"><?php the_category(', '); ?> &raquo;</h3>
	<div class="title"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></div>
	<div class="meta">[ <?php the_time('j M Y') ?> | <?php comments_popup_link('No Comment', 'One Comment', '% Comments');?> <?php if(function_exists('the_views')) { ?>| <?php the_views(); } ?>]</div>	
	
	<div class="spoiler">
      
       <?php if (has_post_thumbnail()) { 
				?>
					 <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
					 	<?php
					 		the_post_thumbnail('front-list',array('class'=>'front-list-thumb-wrapper', 'title'=>$title));
						?>
                	</a>
				<?php
				} else 
				if (isset($values[0])){
				?> 
					<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
					<img src="<?php echo bloginfo('template_url'); ?>/scripts/timthumb.php?src=/<?php echo urlencode($values[0]); ?>&amp;w=150&amp;h=150&amp;zc=1&amp;q=100" alt="<?php the_title(); ?>" class="left" width="150" height="150"  /></a>
				<?php
				} else {
				?>
                	<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
					<img src="<?php echo bloginfo('template_url'); ?>/scripts/timthumb.php?src=/images/no-image.png&amp;w=150&amp;h=150&amp;zc=1&amp;q=100" alt="<?php the_title(); ?>" class="left" width="150" height="150"  /></a>
                <?php } ?>

	<?php the_excerpt(); ?>
	</div>

	</div>
		
      <?php endwhile; ?>

	<div class="navigation">
		<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } 
			else { ?>

			<div class="right"><?php next_posts_link('Next Page &raquo;') ?></div>
			<div class="left"><?php previous_posts_link('&laquo; Previous Page') ?></div>
			<?php } ?>

	</div>
	
	</div>
		

	<?php get_sidebar(); ?>

	</div>	

<?php get_footer(); ?>
